<?php

/**
 * Cliente form base class.
 *
 * @method Cliente getObject() Returns the current form's model object
 *
 * @package    symmoney
 * @subpackage form
 * @author     469745
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseClienteForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'primer_nombre'    => new sfWidgetFormInputText(),
      'segundo_nombre'   => new sfWidgetFormInputText(),
      'primer_apellido'  => new sfWidgetFormInputText(),
      'segundo_apellido' => new sfWidgetFormInputText(),
      'pais_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pais'), 'add_empty' => false)),
      'fecha_nacim'      => new sfWidgetFormDateTime(),
      'solvente'         => new sfWidgetFormInputCheckbox(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'primer_nombre'    => new sfValidatorString(array('max_length' => 31)),
      'segundo_nombre'   => new sfValidatorString(array('max_length' => 31)),
      'primer_apellido'  => new sfValidatorString(array('max_length' => 31)),
      'segundo_apellido' => new sfValidatorString(array('max_length' => 31)),
      'pais_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Pais'))),
      'fecha_nacim'      => new sfValidatorDateTime(array('required' => false)),
      'solvente'         => new sfValidatorBoolean(),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('cliente[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Cliente';
  }

}
